home *** CD-ROM | disk | FTP | other *** search
- Path: risky.ecs.umass.edu!usenet
- From: jvinson@cheux.ecs.umass.edu (Jack Vinson)
- Newsgroups: comp.lang.c++
- Subject: Re: template instantiation (was passing references to containers?)
- Date: 20 Mar 1996 16:06:50 -0500
- Organization: University of Massachusetts
- Message-ID: <wo3f735v9x.fsf@cheux.ecs.umass.edu>
- References: <wozq9lc29c.fsf@cheux.ecs.umass.edu>
- <wopwaglpjo.fsf_-_@cheux.ecs.umass.edu>
- <Pine.LNX.3.91.960319132516.9204A-100000@applink>
- NNTP-Posting-Host: cheux.ecs.umass.edu
- To: Brian Haskett <haskett@applink.net>
- X-Newsreader: September Gnus v0.54/Emacs 19.30
-
- >>>>> "BH" == Brian Haskett <haskett@applink.net> writes:
-
- BH> On 13 Mar 1996, Jack Vinson wrote:
-
- >> From reading this group, it appears that the solutions is to add a dummy
- >> function to each file (or to a common .h file) with variables of the
- >> appropriate types.
- >>
- >> void foo()
- >> {
- >> array<class1> c1;
- >> array<class2> c2;
- >> }
-
- BH> I don't like the looks of this solution. Unless I am mistaken, it appears
- BH> that every object file created based on the header file that contains
- BH> foo() will have the definition of foo() in it? So on a large project like
- BH> what I am working on, with hundreds of object files, foo() will be defined
- BH> in all of them? Not to mention the added information necessary to
- BH> instantiate that template for every object file, needed or not.
-
- I don't either. What I've done in my large project is simply create a
- filename_junk() function which does the same thing as foo() above. This
- way, at least, there won't be a zillion versions of foo() sitting around.
- In addition, I only add templates for those variables I will need in that
- particular object file.
-
- --
- Jack Vinson jvinson@cheux.ecs.umass.edu
- "I wish I were spatial, but I'm a plane." - Radiohead (sorta)
-